home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / TimeSchedulerPQ.cc,v < prev    next >
Text File  |  1989-10-16  |  3KB  |  104 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @@;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.37.57;  author grunwald;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 3.2
  21. log
  22. @Start using Gnu library heaps for schedulers
  23. @
  24. text
  25. @// This may look like C code, but it is really -*- C++ -*-
  26. /* 
  27. Copyright (C) 1988 Free Software Foundation
  28.     written by Doug Lea (dl@@rocky.oswego.edu)
  29.  
  30. This file is part of GNU CC.
  31.  
  32. GNU CC is distributed in the hope that it will be useful,
  33. but WITHOUT ANY WARRANTY.  No author or distributor
  34. accepts responsibility to anyone for the consequences of using it
  35. or for whether it serves any particular purpose or works at all,
  36. unless he says so in writing.  Refer to the GNU CC General Public
  37. License for full details.
  38.  
  39. Everyone is granted permission to copy, modify and redistribute
  40. GNU CC, but only under the conditions described in the
  41. GNU CC General Public License.   A copy of this license is
  42. supposed to have been given to you along with GNU CC so you
  43. can know your rights and responsibilities.  It should be in a
  44. file named COPYING.  Among other things, the copyright notice
  45. and this notice must be preserved on all copies.  
  46. */
  47.  
  48. //#include <builtin.h>
  49. #include <assert.h>
  50. #include "TimeSchedulerPQ.h"
  51.  
  52.  
  53. // non-implemented virtuals
  54. // these are defined to do nonsensical but type-legal things
  55. // They need to be defined in order to fill the vtable
  56.  
  57. Pix   TimeSchedulerPQ::enq(TimeScheduler&)       { error("unimplemented"); return 0; }
  58. void  TimeSchedulerPQ::del_front()     { error("unimplemented"); }
  59. void  TimeSchedulerPQ::del(Pix)        { error("unimplemented"); }
  60. Pix   TimeSchedulerPQ::first()         { error("unimplemented"); return 0; }
  61. void  TimeSchedulerPQ::next(Pix&)      { error("unimplemented"); }
  62. TimeScheduler&  TimeSchedulerPQ::operator()(Pix) { error("unimplemented"); return *((TimeScheduler*)0); }
  63. TimeScheduler&  TimeSchedulerPQ::front()         { error("unimplemented"); return *((TimeScheduler*)0); }
  64. int   TimeSchedulerPQ::OK()            { error("unimplemented"); return 0; }
  65.  
  66. TimeScheduler TimeSchedulerPQ::deq()
  67. {
  68.   TimeScheduler x = front();
  69.   del_front();
  70.   return x;
  71. }
  72.  
  73. Pix TimeSchedulerPQ::seek(TimeScheduler& item)
  74. {
  75.   for (Pix i = first(); i != 0 && !(TimeSchedulerEQ((*this)(i), item)); next(i));
  76.   return i;
  77. }
  78.  
  79. int TimeSchedulerPQ::owns(Pix idx)
  80. {
  81.   if (idx == 0) return 0;
  82.   for (Pix i = first(); i; next(i)) if (i == idx) return 1;
  83.   return 0;
  84. }
  85.  
  86. void TimeSchedulerPQ::clear()
  87. {
  88.   while (count != 0) del_front();
  89. }
  90.  
  91. int TimeSchedulerPQ::contains (TimeScheduler& item)
  92. {
  93.   return seek(item) != 0;
  94. }
  95.  
  96.  
  97. void TimeSchedulerPQ::error(char* msg)
  98. {
  99. //  (*lib_error_handler)("PQ", msg);
  100.     assert2(0,msg);
  101. }
  102.  
  103. @
  104.